package com.project.controller;

import com.project.bean.StudentBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {

    @RequestMapping("checkName")
    public String checkName(String userName){
        if("java".equals(userName)){
            return "ok";
        }
        else{
            return "no";
        }
    }

    @RequestMapping("getList")
    public List<StudentBean> getList(){
        List<StudentBean> list = new ArrayList<>();
        list.add(new StudentBean(12,"刘三", LocalDate.parse("1998-03-05")));
        list.add(new StudentBean(4,"何威", LocalDate.parse("1994-09-30")));
        list.add(new StudentBean(8,"周力", LocalDate.parse("1995-11-23")));
        list.add(new StudentBean(5,"吴军", LocalDate.parse("1986-04-20")));

        return list;
    }
}
